﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace jnagr.Web.info
{
    public partial class index : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                CheckMenu("07");
                checkright.Titlename = getTitlename(6);
                BLL.info bll = new BLL.info();
                string sql = " caname='通知公告'";
                DataSet ds;
                ds = bll.GetListV(10, sql, "infotime desc");
                Repeater1.DataSource = ds.Tables[0];
                Repeater1.DataBind();
                sql = " caname='系统服务'";
                ds = bll.GetListV(10, sql, "infotime desc");
                Repeater2.DataSource = ds.Tables[0];
                Repeater2.DataBind();
                sql = " caname='设备信息'";
                ds = bll.GetListV(10, sql, "infotime desc");
                Repeater3.DataSource = ds.Tables[0];
                Repeater3.DataBind();
                //sql = " caname='专家平台'";
                //ds = bll.GetListV(10, sql, "infotime desc");
                //Repeater4.DataSource = ds.Tables[0];
                //Repeater4.DataBind();
            }

        }
        public static string getStr(string s, int l, string endStr)
        {
            string temp = s.Substring(0, (s.Length < l) ? s.Length : l);

            if (Regex.Replace(temp, "[\u4e00-\u9fa5]", "zz", RegexOptions.IgnoreCase).Length <= l)
            {
                return temp;
            }
            for (int i = temp.Length; i >= 0; i--)
            {
                temp = temp.Substring(0, i);
                if (Regex.Replace(temp, "[\u4e00-\u9fa5]", "zz", RegexOptions.IgnoreCase).Length <= l - endStr.Length)
                {
                    return temp + endStr;
                }
            }
            return endStr;
        }
    }
}